﻿using AiBLSmartEdu.Module.Auth.API.Configurations;
using FrameworkCore.DI;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;

namespace AiBLSmartEdu.Module.Auth.API.Interfaces;

/// <summary>
/// 生成Token服务
/// </summary>
public interface ITokenService : IScopedDependency
{
    /// <summary>
    /// 生成Token
    /// </summary>
    /// <param name="claims">Token信息</param>
    /// <param name="options">生成Token配置信息</param>
    /// <param name="isRefreshToken">是否为刷新Token</param>
    /// <returns>返回Tokne字符串</returns>
    Task<string> BuildAsync(IEnumerable<Claim> claims, JwtSettings options, bool isRefreshToken = false);

    /// <summary>
    /// 解密Token
    /// </summary>
    /// <param name="jwtToken"></param>
    /// <returns></returns>
    JwtSecurityToken Decode(string jwtToken);
}

